home *** CD-ROM | disk | FTP | other *** search
/ Family Forum 261 / SOMC Family Forum 261.iso / Xtras / Behavior Library.cst / 00015_Script_Message All Sprites < prev    next >
Text File  |  1997-11-17  |  2KB  |  58 lines

  1. -- Message   Send to All Sprites  
  2.  
  3. -- Messaging
  4. -- behavior library version 1.1
  5.  
  6. -- EventtoSend must be a symbol
  7. -- whichEvent inits the action
  8.  
  9. -- also functions through lingo by handling message 'initSendAllSprites', 
  10. -- for example if this behavior was assigned to sprite 5, use
  11. -- sendsprite 5, #initSendAllSprites
  12.  
  13. property whichEvent, eventToSend, params
  14.  
  15. on initSendAllSprites me
  16.   init me
  17. end
  18.  
  19. on mouseUp me
  20.   if whichEvent = #mouseup    then init me
  21. end
  22.  
  23. on mouseDown me
  24.   if whichEvent = #mousedown  then init me
  25. end
  26.  
  27. on prepareFrame me
  28.   if whichEvent = #prepareframe then init me
  29. end
  30.  
  31. on enterFrame me
  32.   if whichEvent = #enterframe then init me
  33. end
  34.  
  35. on exitFrame me
  36.   if whichEvent = #exitframe  then init me
  37. end
  38.  
  39. on init me
  40.   set doit = "sendAllSprites the EventToSend of me," && params
  41.   do doit
  42. end
  43.  
  44. ---
  45.  
  46. on getPropertyDescriptionList
  47.   
  48.   set p_list = [    #EventToSend: [ #comment:   "Message:",                     #format:   #symbol,                    #default:   #generic_event ],    #Params:      [ #comment:   "Param1, param2, ...",                     #format:   #string,                    #default:   "" ],     #WhichEvent: [ #comment:   "Initializing Event:",                     #format:   #symbol,                      #range: [ #MouseUp, #MouseDown, #PrepareFrame, #EnterFrame, #ExitFrame, #InitSendAllSprites],                    #default:   #MouseUp ]                  ]
  49.   return p_list
  50.   
  51. end
  52.  
  53. on getBehaviorDescription
  54.   return "Sends a message to every sprite in the current frame when the specified event occurs. Any behaviors that are triggered by the message will be executed." & RETURN & "PARAMETERS:" & RETURN & "ò Message - Enter the message to send."  & RETURN & "ò Params  - Enter the parameters to be sent with the message, seperated by commas."  & RETURN & "ò Initializing Event - Specify the event that triggers the behavior."   
  55.   
  56. end
  57.  
  58.